/*
 * Copyright (c) 2020 hebeiyiliuba.com
 * All rights reserved.
 *
 */
package org.jeecg.modules.middleware.rabbitmq.gen.handler.impl;

import com.alibaba.fastjson.JSONObject;
import org.jeecg.modules.middleware.rabbitmq.gen.EnumGenHandler;
import org.jeecg.modules.middleware.rabbitmq.gen.handler.IGenMqHandle;
import org.jeecg.modules.wlhy.report.ShippingNoteApiAlct56Service;
import org.jeecg.modules.wlhy.shipping.entity.HyShippingNote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 取消运单-队列消息接收方法
 *
 * @author duanlikao
 * @created 2022/3/30
 */
@Service
public class ShippingCancelHandler implements IGenMqHandle {

    @Autowired
    private ShippingNoteApiAlct56Service shippingNoteApiAlct56Service;

    @Override
    public String getHandlerName() {
        return EnumGenHandler.SHIPPING_CANCEL.getHandlerName();
    }

    @Override
    public void handle(String channel , String msg) {
        HyShippingNote hyShippingNote =  JSONObject.parseObject(msg, HyShippingNote.class);
        if("1".equals(hyShippingNote.getAlctIdentification())){
            //陆交开放平台
            shippingNoteApiAlct56Service.cancelShippingNote(hyShippingNote);
        }
    }
}
